package demo5_lambda;

public class Main {
    public static void main(String[] args) {
        //lambda表达式写法（）->{}
        Thread thread=new Thread(()->{
            while (true) {
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                System.out.println("Runnable匿名内部类正在执行run方法，采用lambda表达式方式");
            }
        });
        //启动线程
        thread.start();
        while (true){
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println("Main方法正在执行 ");
        }

    }
}
